<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of RegisterDetailsInfo
 *
 * @author ziad
 */
class RegisterDetailsInfo extends UsersInfoForm{
    public function configure() {

		$this->useFields(array(
			'name',
                        'email',
			'address',
			'country',
		));

		 # Edit default widget Schema
		$this->widgetSchema['step'] = new sfWidgetFormInputHidden();

		$this->widgetSchema['email_again'] = new sfWidgetFormInput();

		$this->widgetSchema->moveField('email_again', 'after', 'email');

		 # Edit default validator Schema
                $this->validatorSchema['email'] = new sfValidatorAnd(array($this->validatorSchema['email'],
                                                                            new sfValidatorEmail(array(), array('invalid'=>'Incorrect email format')),
                                                                            new sfValidatorDoctrineUnique(array('model'=>'UsersInfo', 'column'=>'email'), array('invalid'=>'this email is already used', 'required'=>true))
                                                                            ));


		$this->validatorSchema['email_again'] = clone $this->validatorSchema['email'];

		$this->mergePostValidator(new sfValidatorSchemaCompare('email', sfValidatorSchemaCompare::EQUAL, 'email_again', array(), array('invalid' => 'The two e-mails must be the same.')));

		$this->validatorSchema->addOption('allow_extra_fields', true);

		$this->setDefaults(array(
			'step' => 2
    	));
	}
}

?>
